/**
 * 获取商品信息功能
 */

import { ref } from 'vue'
import { useRoute } from 'vue-router'
import { findGoods } from '@/api/good'

export function useGoodData () {
  const goodData = ref({})
  const route = useRoute()
  async function loadGoodData () {
    const res = await findGoods(route.params.id)
    goodData.value = res.result
  }
  loadGoodData()
  return {
    goodData
  }
}
